<?php 
  // AQ_ID_COPYRIGHT_PHP_WHYWAIT
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        <title>Mobile wait time </title>
        <meta name="viewport" content="width=device-width, initial-scale=1"> 
            <?php
            //   Yii::app()->clientScript->registerScriptFile(Yii::app()->request->baseUrl . '/js/jquery1.7.1.js');
            Yii::app()->clientScript->registerCoreScript('jquery.ui');
            ?>
            <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/jquery-ui.css" media="screen, projection" />
            <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/waittime_mobile.css" media="screen, projection" />
            <script>
                
             
                $(function() {
                    var inputvalue = $('input[id="WaitTimeFormModel_wait_time"]').val();
                    var defaultvalue = inputvalue + ' Min';
                    $('#waittimelabel').html(defaultvalue)
                    $( ".quick_chang" ).click(function() {
                        $('.quick_chang').each(function(){
                            $(this).addClass( "change_color_black");
                            $(this).removeClass( "change_color_blue");
                        })
                        $(this).addClass( "change_color_blue");
                    });
		
                });
              
                function changeWaitTime(obj){
                    if(obj.value=='1 hour+')
                    {
                        $('#waittimelabel').html('60 Min');
                        $('input[id="WaitTimeFormModel_wait_time"]').val('60');

                     
                        
                    }
                    else if(obj.value=='1.5 hour+'){
                        $('#waittimelabel').html('90 Min');
                        $('input[id="WaitTimeFormModel_wait_time"]').val('90');
                        
                        
                    }
                    else{
                        
                        var wait = parseInt(obj.value)+' Min';
                        $('#waittimelabel').html(wait); 
                        $('input[id="WaitTimeFormModel_wait_time"]').val(parseInt(obj.value));
                       
                    }
                   
                }

            </script>
            <script type="text/javascript" >
                $(document).ready(function(){
                    $(document).idleTimeout({
                        inactivity: 1080000, 
                        noconfirm: 10000, 
                        sessionAlive: 10000,
                        //                        inactivity: 30000,
                        //                        noconfirm: 10000,
                        //                        sessionAlive: 10000,
                        click_reset: true,
                        redirect_url: "<?php echo yii::app()->createUrl('user/user/waitTimeLogout'); ?>",
                        logout_url: "<?php echo yii::app()->createUrl('user/user/waitTimeLogout'); ?>",
                        alive_url: "<?php echo yii::app()->createUrl('user/user/waittime'); ?>",
                        //                        redirect_url: '/whywait/ver-1.x/web/admin/index.php/user/user/waitTimeLogout',
                        //                        alive_url: 'http://localhost/whywait/ver-1.x/web/admin/index.php/user/user/waittime',
                        //                        logout_url: '/whywait/index.php/user/user/waitTimeLogout'
                        
                    });
                });
            </script>

    </head>

    <body class="content_background" >
        <?php
        Yii::app()->clientScript->registerScriptFile(Yii::app()->request->baseUrl . '/js/jquery-idleTimeout.js');
// $waitTimeUser= ($model->waitTimeUser) ? $model->waitTimeUser : new Users();
// $profile= ($model->waitTimeUser->profiles) ? $model->waitTimeUser->profiles : new Profiles;
        ?>
        <center>

            <div  data-role="page" class="wiatime_header" id="foo">
                <img id ="headerimg" src="<?php echo Yii::app()->baseUrl ?>/images/logo.jpg"/> 
                <div data-role="header"><h1 style="color: #9C1008">
                        <!--                       <b>Wait Time</b></h1>-->
                </div>
                <div data-role="content">

                    <?php
                    if (!Yii::app()->user->hasRole(WebUser::RESTURANTWAITTIMEUSERROLID)) {

                        $this->redirect(Yii::app()->createAbsoluteUrl('user/user/waittimelogin'));
                    }
                    if (yii::app()->user->hasFlash('WaittimesavedMsg')) {
                        echo Message::Show(yii::app()->user->getFlash('WaittimesavedMsg'), MsgType::Err, true, $animationType = 'fadeOut');
                    }
                    ?>
                    <div class="form">


                        <?php
                        $form = $this->beginWidget('CActiveForm', array(
                                    'id' => 'wait-times-form',
                                    'enableAjaxValidation' => false,
                                ));
                        ?>

                        <?php echo $form->errorSummary($model); ?>

                        <div class="waittime">
                            <div class="waittimeleft"> <h2 class="top">Wait Time!</h2>
                                <div class="waittimelabel" id="waittimelabel"> 



                                </div>
                                <div> <?php echo $form->hiddenField($model, 'wait_time'); ?></div></div>
                            <div class="waittimeright">
                                <div class="rowLabel"> 
                                    <?php echo CHtml::button('0 Minute', array('class' => 'quick_chang change_color_black ui-input-text', 'onclick' => 'changeWaitTime(this)')); ?>
                                    <?php echo CHtml::button('10 Minutes', array('class' => 'quick_chang change_color_black ui-input-text', 'onclick' => 'changeWaitTime(this)')); ?>
                                    <?php echo CHtml::button('20 Minutes', array('class' => 'quick_chang change_color_black ui-input-text ', 'onclick' => 'changeWaitTime(this)')); ?>
                                    <?php echo CHtml::button('30 Minutes', array('class' => 'quick_chang change_color_black ui-input-text ', 'onclick' => 'changeWaitTime(this)')); ?>
                                    <?php echo CHtml::button('40 Minutes', array('class' => 'quick_chang change_color_black ui-input-text ', 'onclick' => 'changeWaitTime(this)')); ?>
                                    <?php echo CHtml::button('50 Minutes', array('class' => 'quick_chang change_color_black ui-input-text ', 'onclick' => 'changeWaitTime(this)')); ?>
                                    <?php echo CHtml::button('1 hour+', array('class' => 'quick_chang change_color_black ui-input-text', 'onclick' => 'changeWaitTime(this)')); ?>
                                    <?php echo CHtml::button('1.5 hour+', array('class' => 'quick_chang change_color_black ui-input-text', 'onclick' => 'changeWaitTime(this)')); ?>

                                </div>
                            </div>

                        </div>
                        <div class="waittime" style="clear: both;">

                            <div class="waittimeleft"><span style=" float: left;padding-left: 268px;"> <h3 class="bar_availity">
                                    Bar Availability</h3></span></div>
                            <div class="waittimeright">
                                <div class="radio">
                                    <?php
                                    echo $form->radioButtonList($model, 'is_bar_available', array('1' => 'Yes', '0' => 'No'), array('class' => ''));
                                    ?>
                                </div>
                            </div>
                            <div class="waittimeleft" style="margin-top: 20px;"> 
                                <span style=" float: left;padding-left: 268px;"><h3 class="bar_availity">Is Disabled</h3>
                            </span>
                            </div>
                            <div class="waittimeright" style="margin-top: 5px;">
                                <div class="radio">
                                    <?php
                                    echo $form->radioButtonList($model, 'is_disabled', array('1' => 'Yes', '0' => 'No'), array('class' => ''));
                                    ?>
                                </div>
                            </div>
                        </div>
                        <div class="waittime" style="clear: both;">
                            <div class="waittimeleft">
                                <div class="logout">
                                    <?php
                                    $this->widget('zii.widgets.CMenu', array(
                                        'items' => array(
                                            array('label' => 'Logout', 'url' => array('/user/user/waitTimeLogout'))
                                        ),
                                    ));
                                    ?>
                                </div>
                            </div>
                            <div class="waittimeright" >
                                <div class="rowsubmit" >
                                    <div class="submitbtn">
                                        <?php echo CHtml::submitButton('Submit', array('class' => 'logout')); ?>
                                    </div>
                                </div> 
                            </div>

                        </div>




                        <?php $this->endWidget(); ?>




                        <br>
                    </div>
                </div>

            </div>


    </body>
</html>